<template>
	<view>
		<view class="content">
			<view class="uni-flex">
				<image src="../../static/image/weixinqianbao.png" mode="" class="weixin-tupian"></image>
				<view class="wexin">
					<view class="wexin-title">微信钱包</view>
					<view class="weixin-shuoming">提现即时到账</view>
				</view>
				<view class="" style="flex: 1;display:flex;flex-direction: row-reverse ;">
					<!-- <view class="weixin-name">{{wxName}}</view> -->
					<image src="../../static/image/yiyuedu.png" v-if="wxName!='未绑定'" mode="" class="queren"></image>
				</view>
				<!-- <image  src="../../static/image/qianjin.png" mode="" class="qianjin"></image> -->
			</view>
		</view>
		<view class="content">
			<view class="tixianbiaoti">提现金额</view>
			<view class="uni-flex" style="border-bottom: 4rpx solid #F2F2F2;padding-bottom: 8rpx;">
				<view class="tixian-fontsize" style="padding-left: 40rpx;padding-right: 32rpx;">￥</view>
				<!-- <view class="tixian-fontsize">{{tixianjine}}</view> -->
				<u-input v-model="tixianjine" :border="false" type="number" height="84" placeholder="输入金额" :clearable="false" :custom-style="{'font-size':'60rpx'}"/>
				
			</view>
			<view class="tishi">
				注：最先微信新规，3元起提，每次提现需收取{{baifeibi}}%提现手续费
			</view>
		</view>
		<view class="" style="padding:20rpx 54rpx 80rpx;" >	
			<submitButtom text="提现" :buttonMethod="submit" backgroundColor="#07C160"></submitButtom>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import submitButtom from "@/components/submit-button/submit-button.vue"
	export default {
		components:{
			submitButtom
		},
		data() {
			return {
				wxName:"未绑定",
				baifeibi:0,
				tixianjine:null,
				uid:uni.getStorageSync("token"),
				isDianji:true
				
			}
		},
		onLoad:function(){
			var that = this;
			var userInfo = uni.getStorageSync("userInfo");
			if(userInfo.wx_name!=undefined && userInfo.wx_name != null && userInfo.wx_name != ''){
				that.wxName = userInfo.wx_name;
			}
			uni.$on('wxBing',function(data){
			        that.wxName = data.wxName;
			 })
			 
			 that.$util.nuiAjax(that.$jiekou.systemCanshu,{type:"tixainshouxufei"},function(res){
			 	if(res.result == 'true'){
			 		that.baifeibi = res.value;
			 	}
			 	
			 });
			 
		},
		methods: {
			submit:function(){
				if(!this.isDianji){
					return;
				}
				this.isDianji = false;
				var that = this;
				if(that.tixianjine==null || that.tixianjine=="" || that.tixianjine==0){
					that.$refs.uToast.show({
						title: "请输入提现金额",
						duration:1000
					});
					this.isDianji = true;
					return ;
				}else if(that.tixianjine<3){
					that.$refs.uToast.show({
						title: "提现金额不能小于3元",
						duration:1000
					});
					this.isDianji = true;
					return;
				}
				var that = this;
				that.$util.nuiAjax(that.$jiekou.tixianWx,{uid:that.uid,jine:that.tixianjine},function(res){
					if(res.result == 'true'){
						that.$refs.uToast.show({
							title: "提现成功",
							duration:1000,
							back:true
						});
						this.isDianji = true;
						uni.$emit("updateJine");
					}else{
						that.$refs.uToast.show({
							title: res.message,
							duration:1000
						});
						this.isDianji = true;
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.tishi{
		// height:34rpx;
		font-size:24rpx;
		font-weight:400;
		color:rgba(255,149,0,1);
		line-height:34rpx;
		padding:38rpx 0 40rpx 40rpx;
	}
	page {
		background-color: $page-bg-color;
	}
	.tixian-fontsize{
		height:84rpx;
		font-size:60rpx;
		font-weight:400;
		color:rgba(51,51,51,1);
		line-height:84rpx;
	}
	.tixianbiaoti{
		// height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:rgba(51,51,51,1);
		line-height:40rpx;
		padding: 40rpx;
	}
	.weixin-name{
		padding: 50rpx 14rpx 0 0;
		height:40rpx;
		font-size:28rpx;
		font-weight:400;
		color:rgba(51,51,51,1);
		line-height:40rpx;
	}
	.wexin-title{
		// height:40rpx;
		font-size:28rpx;
		font-weight:500;
		color:rgba(51,51,51,1);
		line-height:40rpx;
		padding-top: 32rpx;
	}
	.weixin-shuoming{
		height:34rpx;
		font-size:24rpx;
		font-weight:400;
		color:rgba(138,139,144,1);
		line-height:34rpx;
	}
	.queren{
		width: 32rpx;
		height: 32rpx;
		margin-top: 54rpx;
		margin-right: 10rpx;
	}
	.qianjin{
		width: 10rpx;
		height: 20rpx;
		margin-top: 60rpx;
		margin-right: 30rpx;
	}
	.weixin-tupian{
		width: 54rpx;
		height: 48rpx;
		margin:46rpx 20rpx  46rpx 30rpx;
	}
	.content {
		box-shadow: 0px 8rpx 16rpx 0px rgba(246, 247, 248, 1);
		background-color: #FFFFFF;
		margin-top:20rpx;
	}
</style>
